﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using SmsVotes.SmsVoting;

namespace SmsVotes
{
    public partial class SmsVotingPage : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

            if (Request.QueryString.Count != 0)
            {
                if (!string.IsNullOrEmpty(Request.QueryString["cmd"]))
                {
                    string cmd = Request.QueryString["cmd"];
                    switch (cmd.ToLower())
                    {
                        case "createvote":
                            phControl.Controls.Add(LoadControl("SmsVoting/Vote.ascx"));
                            break;
                        case "editvote":
                            phControl.Controls.Add(LoadControl("SmsVoting/Vote.ascx"));
                            break;
                        case "createquestion":
                            phControl.Controls.Add(LoadControl("SmsVoting/Question.ascx"));
                            break;
                        case "editquestion":
                            phControl.Controls.Add(LoadControl("SmsVoting/Question.ascx"));
                            break;
                        case "currentquestion":
                            phControl.Controls.Add(LoadControl("SmsVoting/CurrentQuestion.ascx"));
                            break;
                        case "runvote":
                            phControl.Controls.Add(LoadControl("SmsVoting/CurrentVote.ascx"));
                            break;
                        case "history":
                            phControl.Controls.Add(LoadControl("SmsVoting/VotesHistory.ascx"));
                            break;
                        case "votehistory":
                            phControl.Controls.Add(LoadControl("SmsVoting/VoteHistory.ascx"));
                            break;
                        case "questionhistory":
                            phControl.Controls.Add(LoadControl("SmsVoting/CurrentQuestion.ascx"));
                            break;
                        default:
                            phControl.Controls.Add(LoadControl("SmsVoting/Votes.ascx"));
                            break;

                    }
                }
                else
                    phControl.Controls.Add(LoadControl("SmsVoting/Votes.ascx"));

            }
            else
                phControl.Controls.Add(LoadControl("SmsVoting/Votes.ascx"));


        }
    }
}
